package com.huazai.juc.cec.thread.july.eighteen;

import com.huazai.juc.utils.SleepUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * 本类为了练习一下之前学过的各种api方法，不为别人，只为自己！！！
 */
@Slf4j
public class ApiMethodPractice {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.info("清洗烧水壶，一分钟");
            SleepUtil.MySleep(1);
            log.info("正在烧水，五分钟");
            SleepUtil.MySleep(5);
        }, "老王");

        Thread t2 = new Thread(() -> {
            SleepUtil.MySleep(1);
            log.info("正在洗茶叶");
            SleepUtil.MySleep(2);
            log.info("正在洗茶杯");
            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.info("可以泡茶了呀");
        }, "老李");

        t1.start();
        t2.start();
    }
}
